let GM = require('GM');
cc.Class({
    extends: cc.Component,

    properties: {
    //点击音效
    click: cc.AudioSource,
    //死亡音效
    die: cc.AudioSource,
    //爆炸音效
    explode: cc.AudioSource,
    //结算音效
    gameover: cc.AudioSource,
    //金币音效
    gold: cc.AudioSource,
    //加速音效
    sprint: cc.AudioSource,
    },

   
    start () {

    },
    //点击音效
    onPlayClick(){
        if(GM.voice == 0) return;
        this.click.play();
    },
     //结算音效
     onPlayGameover(){
        if(GM.voice == 0) return;
        this.gameover.play();
     },
     //爆炸音效
    onPlayExplode(){
        if(GM.voice == 0) return;
        this.explode.play();
    },
     //死亡音效
    onPlayDie(){
        if(GM.voice == 0) return;
        this.die.play();
    },
     //金币音效
     onPlayGold(){
        if(GM.voice == 0) return;
        this.gold.play();
    },
      //加速音效
    onPlaySprint(){
        if(GM.voice == 0) return;
        this.sprint.play();
    },
    //停止播放加速音效
    onStopSprint(){
        if(GM.voice == 0) return;
        this.sprint.stop();
    },
    onStop(){
        GM.voice = 0;
    }
    
});
